import styles from "./index.module.less";
import TimelyFact from "./TimelyFact";
import TransformBoard from "./TransformBoard";
import CustomBoard from "./CustomBoard";
import { fetchDicts } from "@userList/utils";
import { merchantMap } from "./store";
import { dicts } from "@userList/dict";
export default defineComponent({
  setup() {
    const _self = reactive<any>(getCurrentInstance());
    const fetchSearchMap = async () => {
      const res: any = await fetchDicts();
      dicts.value = res;
      merchantMap.value = [{ label: $t("dict6"), value: "" }].concat(
        res?.merchantUsers?.map((item) => ({
          label: item.name,
          value: item.id,
        })) ?? []
      );
    };
    onMounted(async () => {
      await fetchSearchMap();
      _self.refs.timely_fact.initPage();
      _self.refs.transform_board.initPage();
      _self.refs.custom_board.initPage();
    });
    return () => (
      <>
        <div class={styles.container}>
          <TimelyFact ref="timely_fact" />

          <TransformBoard ref="transform_board" />
          <CustomBoard ref="custom_board" />
        </div>
      </>
    );
  },
});
